package model


func ValidateUser(phone string) (obj UserDb, err error) {
	return obj, db.Where("phone=?", phone).Take(&obj).Error
}

func CreateUser(obj UserDb) error {
	return db.Save(&obj).Error
}

func Login(phone string,passWord string) (obj UserDb, err error) {
	return obj, db.Where("phone=? AND pass_word=?", phone,passWord).Take(&obj).Error
}

func UpdataToken(userId uint,token string) (obj UserDb, err error) {
	return obj,db.Model(&obj).Where("id = ?", userId).Update("token", token).Error
}







